package com.tengju.user.domain.model.sign;

import lombok.AllArgsConstructor;

import java.util.List;

@AllArgsConstructor
public enum CrmStarSignStatus {

    SIGNING(11, "签约中", List.of(StarSignStatus.SEND_ALREADY, StarSignStatus.SURVEY_ALREADY, StarSignStatus.AUDITING, StarSignStatus.AUDIT_ALREADY, StarSignStatus.EXAM_ALREADY)),
    SEND_ALREADY(1, "已邀约", List.of(StarSignStatus.SEND_ALREADY)),
    SURVEY_ALREADY(2, "问卷完成", List.of(StarSignStatus.SURVEY_ALREADY)),
    AUDITING(3, "待审核", List.of(StarSignStatus.AUDITING)),
    AUDIT_REFUSE(4, "审核拒绝", List.of(StarSignStatus.AUDIT_REFUSE)),
    AUDIT_ALREADY(5, "审核通过", List.of(StarSignStatus.AUDIT_ALREADY)),
    EXAM_ALREADY(6, "考试完成", List.of(StarSignStatus.EXAM_ALREADY)),
    SIGN_ALREADY(7, "签约完成", List.of(StarSignStatus.SIGN_ALREADY)),
    END(8, "已终止", List.of(StarSignStatus.END)),
    ;

    Integer val;
    String desc;
    List<StarSignStatus> signStatusList;

    public Integer getVal() {
        return val;
    }

    public String getDesc() {
        return desc;
    }

    public static List<StarSignStatus> parse(Integer val) {
        if (val == null) {
            return null;
        }
        for (CrmStarSignStatus status : values()) {
            if (status.val.equals(val)) {
                return status.signStatusList;
            }
        }
        return null;
    }
}
